package com.freejava.testmutildatasource.service;

import com.freejava.testmutildatasource.dao.cluster.MyStoreDao;
import com.freejava.testmutildatasource.dao.master.MySingerDao;
import com.freejava.testmutildatasource.entity.MySinger;
import com.freejava.testmutildatasource.entity.MyStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MyStoreService {

    // 从库的白哦
    @Autowired
    private MyStoreDao myStoreDao;

    // 主库的表
    @Autowired
    private MySingerDao mySingerDao;

    public MyStore findByName(String name) {
        // 主库中获取歌手信息
        MySinger mySinger = mySingerDao.findByName(name);
        System.out.println(mySinger);
        // 从库中获取商店信息
        MyStore myStore = myStoreDao.findByName(name);
        System.out.println(myStore);
        return myStore;
    }
}
